#include "widget.h"
#include "ui_widget.h"

#if _MSC_VER >= 1600 //MSVC2015>1899, MSVC_VER=14.0
    #pragma execution_ character_ set("utf-8")
#endif

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    ui->horizontalSlider->setValue(ui->battery->powerLevel());
}

Widget::~Widget()
{
    delete ui;
}


void Widget::on_horizontalSlider_valueChanged(int value)
{
     ui->battery->setPowerLevel(value);
}

void Widget::on_battery_powerLevelChanged(int arg1)
{
    //电量值改变时，在标签中显示
    QString str= "当前电量:" + QString("%1 %").arg(arg1);

    ui->LabInfo->setText(str) ;
}

